package com.hc.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hc.common.bean.PageBean;
import com.hc.domain.Technology;
import com.hc.domain.User;
import com.hc.query.CategoryVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.hc.domain.Category;
import com.hc.mapper.CategoryMapper;
import com.hc.service.CategoryService;

import java.util.List;

/**
 * @author: hecai
 * @date: 2021/11/9 11:17
 * @description:
 */
@Service
public class CategoryServiceImpl implements CategoryService{

    @Resource
    private CategoryMapper categoryMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return categoryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Category record) {
        return categoryMapper.insert(record);
    }

    @Override
    public int insertSelective(Category record) {
        return categoryMapper.insertSelective(record);
    }

    @Override
    public Category selectByPrimaryKey(Long id) {
        return categoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Category record) {
        return categoryMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Category record) {
        return categoryMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Category> getCategoryByCondition() {
        return categoryMapper.getCategoryByCondition();
    }

    @Override
    public List<Long> selectIdsByName(String[] names) {
        return categoryMapper.selectIdsByName(names);
    }

    @Override
    public List<Category> selectIdsByPid(Long pid) {
        return categoryMapper.selectIdsByPid(pid);
    }

    @Override
    public PageBean<Category> selectPageByCondition(Integer pageNum, Integer pageSize, CategoryVO categoryVO) {
        Page<Category> page = PageHelper.startPage(pageNum, pageSize);
        categoryMapper.selectCategorysByCondition(categoryVO);
        PageBean<Category> pageBean = PageBean.init(page);
        return pageBean;
    }
    @Override
    public int avctiveByPrimaryKey(Long id) {
        return categoryMapper.avctiveByPrimaryKey(id);
    }

    @Override
    public int disabledByPrimaryKey(Long id) {
        return categoryMapper.disabledByPrimaryKey(id);
    }

    @Override
    public Category selectByName(String name) {
        return categoryMapper.selectByName(name);
    }

    @Override
    public String selectNameByPrimaryKey(Long id) {
        return categoryMapper.selectNameByPrimaryKey(id);
    }
}